home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / libiconv_src.lha / include / iconv.h.msvc-shared < prev    next >
Encoding:
Text File  |  2000-11-07  |  4.0 KB  |  118 lines

  1. /* Copyright (C) 1999-2000 Free Software Foundation, Inc.
  2.    This file is part of the GNU ICONV Library.
  3.  
  4.    The GNU ICONV Library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public License as
  6.    published by the Free Software Foundation; either version 2 of the
  7.    License, or (at your option) any later version.
  8.  
  9.    The GNU ICONV Library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public
  15.    License along with the GNU ICONV Library; see the file COPYING.LIB.  If not,
  16.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.    Boston, MA 02111-1307, USA.  */
  18.  
  19. /* When installed, this file is called "iconv.h". */
  20.  
  21. #ifndef _LIBICONV_H
  22. #define _LIBICONV_H
  23.  
  24. #define _LIBICONV_VERSION 0x0103    /* version number: (major<<8) + minor */
  25.  
  26. #ifdef BUILDING_LIBICONV
  27. #define LIBICONV_DLL_EXPORTED __declspec(dllexport)
  28. #else
  29. #define LIBICONV_DLL_EXPORTED __declspec(dllimport)
  30. #endif
  31.  
  32. /* We would like to #include any system header file which could define
  33.    iconv_t, 1. in order to eliminate the risk that the user gets compilation
  34.    errors because some other system header file includes /usr/include/iconv.h
  35.    which defines iconv_t or declares iconv after this file, 2. when compiling
  36.    for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
  37.    binary compatible code.
  38.    But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
  39.    has been installed in /usr/local/include, there is no way any more to
  40.    include the original /usr/include/iconv.h. We simply have to get away
  41.    without it.
  42.    Ad 1. The risk that a system header file does
  43.    #include "iconv.h"  or  #include_next "iconv.h"
  44.    is small. They all do #include <iconv.h>.
  45.    Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
  46.    has to be a scalar type because (iconv_t)(-1) is a possible return value
  47.    from iconv_open().) */
  48.  
  49. /* Define iconv_t ourselves. */
  50. #undef iconv_t
  51. #define iconv_t libiconv_t
  52. typedef void* iconv_t;
  53.  
  54. /* Get size_t declaration. */
  55. #include <stddef.h>
  56.  
  57. /* Get errno declaration and values. */
  58. #include <errno.h>
  59. /* Some systems, like SunOS 4, don't have EILSEQ. On these systems, define
  60.    EILSEQ ourselves, but don't define it as EINVAL, because iconv() callers
  61.    want to distinguish EINVAL and EILSEQ. */
  62. #ifndef EILSEQ
  63. #define EILSEQ ENOENT
  64. #endif
  65.  
  66.  
  67. #ifdef __cplusplus
  68. extern "C" {
  69. #endif
  70.  
  71.  
  72. /* Allocates descriptor for code conversion from encoding `fromcode' to
  73.    encoding `tocode'. */
  74. #ifndef LIBICONV_PLUG
  75. #define iconv_open libiconv_open
  76. #endif
  77. extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode);
  78.  
  79. /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
  80.    starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
  81.    `*outbuf'.
  82.    Decrements `*inbytesleft' and increments `*inbuf' by the same amount.
  83.    Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */
  84. #ifndef LIBICONV_PLUG
  85. #define iconv libiconv
  86. #endif
  87. extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
  88.  
  89. /* Frees resources allocated for conversion descriptor `cd'. */
  90. #ifndef LIBICONV_PLUG
  91. #define iconv_close libiconv_close
  92. #endif
  93. extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd);
  94.  
  95.  
  96. #ifndef LIBICONV_PLUG
  97.  
  98. /* Nonstandard extensions. */
  99.  
  100. /* Control of attributes. */
  101. #define iconvctl libiconvctl
  102. extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
  103.  
  104. /* Requests for iconvctl. */
  105. #define ICONV_TRIVIALP            0  /* int *argument */
  106. #define ICONV_GET_TRANSLITERATE   1  /* int *argument */
  107. #define ICONV_SET_TRANSLITERATE   2  /* const int *argument */
  108.  
  109. #endif
  110.  
  111.  
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115.  
  116.  
  117. #endif /* _LIBICONV_H */
  118.